<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .tab-box {
      width: 300px;
      height: 300px;
      border: 1px solid #000;
    }

    .tab-header {
      display: flex;
      width: 100%;
      height: 40px;
      border-bottom: 1px solid #000;
    }

    .tab-header .item {
      width: calc(100% / 3);
      height: 100%;
      text-align: center;
      line-height: 40px;
    }

    .tab-header .item.active {
      background: #000;
      color: #fff;
    }

    .tab-content {
      width: 100%;
      height: calc(100% - 40px);
    }

    .tab-content .content {
      display: none;
      width: 100%;
      height: 100%;
    }
    .tab-content .content.active {
      display: flex;
      justify-content: center;
      align-items: center;
    }
  </style>
</head>

<body>
  <div class="tab-box J_tab">
    <div class="tab-header">
      <div class="item active">选项一</div>
      <div class="item">选项二</div>
      <div class="item">选项三</div>
    </div>
    <div class="tab-content">
      <div class="content active">内容一</div>
      <div class="content">内容二</div>
      <div class="content">内容三</div>
    </div>
  </div>
  <script src="./index.js"></script>
  <script>
    new window.$Tab('J_tab');
  </script>
</body>

</html>